﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DrawLineManager : MonoBehaviour
{
    private LineRenderer lr;
    public List<Transform> vertices;
    // Start is called before the first frame update
    void Start()
    {
        lr = GetComponent<LineRenderer>();
        DrawArea(vertices);
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    /// <summary>
    /// 绘制检修区域
    /// </summary>
    /// <param name="vertices"></param>
    public void DrawArea(List<Transform> vertices)
    {
        Vector3[] positions = new Vector3[vertices.Count];
        for (int i = 0; i < vertices.Count; i++)
        {
            positions[i] = vertices[i].position;
        }
        lr.positionCount = vertices.Count;
        lr.SetPositions(positions);
    }
}
